<%@page import="java.util.TimeZone"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="bean.entity.Announce"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./css/global.css" />
<link rel="stylesheet" type="text/css" href="./css/announce/editAnnounce.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="./js/announce/editAnnounce.js"></script>
<script type="text/javascript" src="./js/dropdown.js"></script>
<script type="text/javascript" src="./js/slideshow.js"></script>
<title>編輯重要公告</title>
</head>
<body>
	<jsp:include page="../title.jsp"></jsp:include>
	<div id="contentDiv">
		<jsp:include page="../left.jsp"></jsp:include>
		<div id="rightDiv">
			<h1 id="titleH1">編輯重要公告</h1>
			<div id="mainPageDiv">
				<a href="./addAnnounce"><button>新增重要公告</button></a>
				<table id="allAnnounceTable">
					<tr>
						<td class="allAnnounce">標題</td>
						<td class="allAnnounce">內容</td>
						<td class="allAnnounce">發表時間</td>
						<td class="allAnnounce">操作</td>
					</tr>
					<%
						List<Announce> annList = (List<Announce>)request.getAttribute("annList");
						SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
					
						sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
						for (Announce ann: annList) {
							String poTime = sdf.format(ann.getPoTime());
					%>
					<tr>
						<td class="allAnnounce"><%=ann.getTitle()%></td>
						<td class="allAnnounce"><%=ann.getContent()%></td>
						<td class="allAnnounce"><%=poTime%></td>
						<td class="allAnnounce">
							<a href="./modifyAnnounce?id=<%=ann.getKey().getId()%>"><button>修改</button></a>
							<button id="delAnnounceButton-<%=ann.getKey().getId()%>" class="delAnnounce">刪除</button>
						</td>
					</tr>
					<%
						}
					%>
				</table>
			</div>
		</div>
	</div>
	<jsp:include page="../bottom.jsp"></jsp:include>
</body>
</html>